package cm.shit;

import java.util.Arrays;
import java.util.Date;

public class TestCloneArray {
    public static void main(String[] args) {
        int[] x = new int[]{1, 2, 3};
        int[] y = x.clone();
        x[0] = 6;
        System.out.println(Arrays.toString(x));
        System.out.println(Arrays.toString(y));
        Date[] dates = new Date[1];
        dates[0] = new Date();
        Date[] cloned = dates.clone();
        cloned[0] = (Date)dates[0].clone();
        dates[0].setTime(666);
        System.out.println(Arrays.toString(dates));
        System.out.println(Arrays.toString(cloned));

        String[] ss = new String[3];
        for (int i = 0; i < 3; i++) {
            ss[i] = 2 * i + "";
        }
        String[] ssCloned = ss.clone();
        ss[0] = "fuck";
        System.out.println(Arrays.toString(ss));
        System.out.println(Arrays.toString(ssCloned));
    }
}
